package com.example.auth.api;


import com.example.auth.response.Result;
import com.example.auth.service.LoginService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;

/**
 * 短信平台
 */
@Slf4j
@RestController
@RequestMapping("/sms")
public class LoginController {
    @Resource
    LoginService loginService;


    /**
     * 发送短信
     * @param phone 手机号码
     * @param type 短信类型 captcha验证码
     * @return
     */
    @GetMapping("sendSms")
    public Result sendSms(String phone, String type) throws ExecutionException, InterruptedException {
        return loginService.sendSms(phone,type);
    }

    @GetMapping("sendEmail")
    public Result sendEmail(String email,String type) throws ExecutionException, InterruptedException {
        return loginService.sendEmail(email,type);
    }
}
